package start;

public class Thread01 extends  Thread{

    public static void main(String[] args) {

        Thread.currentThread().setName("主线程");

        Thread01 thread01 = new Thread01();
        thread01.setName("Thread-01");
        thread01.start();
        for(int i=1 ; i<=100; i++) {
            System.out.println(Thread.currentThread().getName() + ":" + i);
        }


    }




    @Override
    public void run() {
        for(int i=1 ; i<=100; i++) {
            System.out.println(Thread.currentThread().getName() + ":" + i);
            if(i%2 == 0) {
                this.yield();
            }
        }

    }

}
